<h1 class="h1Text">Choose Payment Option</h1>
<style>
    input[type=radio]{
        width:10px;
    }
</style>
{{$checkout_msg}}
<br/>
<a href="#" onclick="do_toggle()" style="font-size: 12px">Click for Order Details</a>
<div id="order_details" >
    {{load_specific_view name="order_products" module="checkout_reciept"}}
</div>
<br/>
<br/>
<form method="post" action="{{$base_index_url}}/{{$current_stage->get_action_url()}}">
    {{foreach from=$drivers item=driver}}
    <fieldset id="driver_fieldset_{{$driver->get_driver_id()}}" class="driver_fieldset" onclick="make_active('{{$driver->get_driver_id()}}')">
        <table width="100%" >
            <tr>
                <td style="text-align: left ; width: 10px" >
                    <input onclick="highlight_fieldset('{{$driver->get_driver_id()}}')" {{if $payment_driver_selection==$driver->get_driver_id()}}checked{{/if}} class="driver_radio" type="radio" name="driver" id="driver_{{$driver->get_driver_id()}}" value="{{$driver->get_driver_id()}}"/>
                </td>
                <td>{{$driver->get_description()}}</td>
            </tr>
            <tr>
                <td colspan="2" style="text-align: left;padding-left: 25px">{{load_specific_view name=$driver->get_driver_id() module="checkout_payment"}}</td>
            </tr>
        </table>
    </fieldset>
    {{/foreach}}
    <input type="submit"/>
</form>

<script>
    function highlight_fieldset(driver){
        $(".driver_fieldset").css("border", "1px solid #BBBBBB");
        $("#driver_fieldset_"+driver).css("border", "1px solid orange");
    }
    function select_driver_radio(driver){
        $("#driver_"+driver).attr("checked",true);
    }

    function make_active(driver){
        select_driver_radio(driver)
        highlight_fieldset(driver);
    }
    $(document).ready(function(){
        selected = '{{$payment_driver_selection}}';
        if(selected.length>0){
            make_active(selected);
        }
    });

    function do_toggle(){      
        $('#order_details').toggle('fadeOut');
    }
    do_toggle();
</script>